package com.dayuanit.hotal;

import java.util.HashMap;
import java.util.Map;

public class TestString {
    public static void main(String[] args) {
        Map<Integer, String> map = new HashMap<>();
        map.put(1, "tom");
        map.put(2, "bob");
        map.put(3, "jack");

        String name = map.get(1);
        name = "tom2";
//        map.put(1, name);
        System.out.println(map.get(1));//tom or tom2?

        Map<Integer, Food> mapFood = new HashMap<>();
        mapFood.put(1, new Food(1000, "米饭", 9));
        mapFood.put(2, new Food(1001, "宫保鸡丁", 19));

        Food food = mapFood.get(1);
//        food.setName("米饭2");
        String foodName = food.getName();
        foodName = "米饭2";

        mapFood.put(1, food);

        System.out.println(mapFood.get(1).getName());//米饭 or 米饭2?
    }
}
